home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 2.iso / textproc / _j2 / collec / fread.txt < prev    next >
Text File  |  1993-06-28  |  4KB  |  125 lines

  1. '****************************************
  2. 'Reader- Reads the footnotes collected in TRACKER.CSV
  3. '****************************************
  4. Sub MAIN
  5.  
  6. Dim FName$,  HelpTitle$,  KeyTitle$,  HelpID$,  Browse$,  KeyWord$,  Comments$,  BuildTag$
  7.  
  8. GetProjDir ffPath$, ffName$, ErrorLev    'What you'd think
  9. If ErrorLev <> 0 Then Goto Quit
  10. JustDir ffPath$                'Separate the path from the file name...
  11. ChDir ffPath$                '...and change to that directory
  12. JustName ffName$            'Separate the file name from the path
  13. Open ffName$ For Input As #1
  14. 'AppMinimize
  15.  
  16. On Error Goto ErrorFound    'If something goes wrong, show some evidence before quitting
  17. 'create new document
  18. FileNew .NewTemplate = 0, .Template = "normal.dot"
  19. FormatPageSetup .AttributeControls = 0, .ApplyPropsTo = 4, .LeftMargin = ".5", \
  20.     .RightMargin = ".5", .TopMargin = ".5", .BottomMargin = ".5"
  21. FormatPageSetup .AttributeControls = 1, .ApplyPropsTo = 4, .Orientation = 1, \
  22.     .PageWidth = "11", .PageHeight = "8.5"
  23. FormatStyle .Name = "Normal", .BasedOn = "", .AddToTemplate = 0, .Define
  24. FormatDefineStyleChar .Font = "Helvetica", .Points = "8", .Bold = 0
  25.  
  26. TableInsertTable .ConvertFrom = 0, .NumColumns = 8, .NumRows = 1, .InitialColWidth = "Auto"
  27. TableSelectTable
  28.  
  29. 'Get footnotes
  30. savecount = 0    'save every 10 iterations
  31.  
  32. While Not Eof(1)
  33.     Read #1, FName$, HelpTitle$, KeyTitle$, HelpID$, Browse$, KeyWord$, \
  34.     Comments$, BuildTag$
  35.  
  36.     'Now we should be in the first cell of the table
  37.     Insert FName$ : NextCell
  38.     Insert HelpTitle$ : NextCell
  39.     Insert KeyTitle$ : NextCell
  40.     Insert HelpID$ : NextCell
  41.     Insert Browse$ : NextCell
  42.     Insert KeyWord$ : NextCell
  43.     Insert Comments$ : NextCell
  44.     Insert BuildTag$ : NextCell
  45.     If savecount = 10 Then    'save every 10 iterations
  46.         savecount = 0
  47.         FileSaveAs .Name = "feet.doc"
  48.     EndIf
  49.     savecount = savecount + 1
  50. Wend
  51.  
  52. 'Add borders
  53. FormatBorder .FromText = "", .ApplyTo = 3, .Shadow = 0, .TopBorder = 3, .LeftBorder = 3, \
  54.     .BottomBorder = 3, .RightBorder = 3, .HorizBorder = 1, .VertBorder = 1
  55.  
  56. 'Get rid of blank last row
  57. EndOfDocument
  58. LineUp 1
  59. TableSelectRow
  60. EditCut
  61.  
  62. AppRestore        'Make app as it was
  63. Goto GoodEnding    'Skip over error handler
  64.  
  65. ErrorFound:        'Error handling routine.  Show variables and exit gracefully
  66. AppRestore
  67. MsgBox "Error number " + Str$(err)
  68. ShowVars
  69.  
  70. GoodEnding:
  71. Close #1
  72.  
  73. Quit:
  74. End Sub
  75.  
  76.  
  77. '****************************************
  78. Sub GetProjDir(ffPath$, ffName$, ErrorLev)
  79. Dim NumFndFiles, i, n
  80.     FileFind .Location = "All local drives", .Name = "*.csv", .Options = 0, .SortBy = 4
  81.     NumFndFiles = CountFoundFiles()
  82.     Dim HPJ$(NumFndFiles)
  83.     For i = 1 To NumFndFiles
  84.         HPJ$(i - 1) = FoundFileName$(i)
  85.     Next
  86.  
  87.     Begin Dialog UserDialog 558, 142, "Select a footnote file"
  88.         ListBox 14, 43, 414, 84, HPJ$(), .ListBox1
  89.         OKButton 448, 43, 88, 21
  90.         CancelButton 448, 67, 88, 21
  91.         Text 14, 9, 475, 13, "Select the help footnote from which to read"
  92.         Text 14, 22, 187, 13, "the footnote information."
  93.     End Dialog
  94.     Dim HPJ As UserDialog
  95.     n = Dialog(HPJ)        'Figure out how to do On Error here
  96.     If n = 0 Then ErrorLev = 1
  97.     ffName$ = HPJ$(HPJ.ListBox1)
  98.     ffPath$ = ffName$
  99. End Sub
  100.  
  101. '****************************************
  102. Sub JustDir(t$)        'Separate the path from the file name
  103. Dim i
  104.     i = Len(t$)
  105.     While Mid$(t$, i, 1) <> "\"
  106.         i = i - 1
  107.     Wend
  108.     i = i - 1
  109.     t$ = Left$(t$, i)
  110. End Sub
  111.  
  112. '****************************************
  113. Sub JustName(t$)        'Separate the file name from the path
  114. Dim i
  115.     i = Len(t$)
  116.     While Mid$(t$, i, 1) <> "\"
  117.         i = i - 1
  118.     Wend
  119.     i = Len(t$) - i
  120.     t$ = Right$(t$, i)
  121. End Sub
  122.  
  123. '****************************************
  124.  
  125.